package cn.tedu.boot31.controller;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AxiosController {

    @RequestMapping("helloAxios")
    public String hello1(String info) {
        return "请求成功! info="+info;
    }

    /**
     * @RequestBody 注解作用,当客户端发出post请求时,并且提交的是自定义对象,服务端接收参数时
     * 必须使用此注解,否则得不到传递来的参数
     */
    @RequestMapping("hello2Axios")
    public String hello2(@RequestBody String info) {
        return "请求成功! info="+info;
    }
}
